package appgui;

import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import org.eclipse.wb.swing.FocusTraversalOnArray;
import java.awt.Component;

public class SimpleMainWindow {

	private JFrame simpleMain;
	private TextInputFrame recipeInput;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) 
	{
		EventQueue.invokeLater(new Runnable() 
		{
			public void run() 
			{
				try 
				{
					SimpleMainWindow window = new SimpleMainWindow();
					window.simpleMain.setVisible(true);
				} 
				
				catch (Exception e) 
				{
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public SimpleMainWindow() 
	{
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() 
	{
		recipeInput = new TextInputFrame();
		
		simpleMain = new JFrame();
		simpleMain.setTitle("Main Menu");
		simpleMain.setBounds(100, 100, 450, 300);
		simpleMain.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		simpleMain.getContentPane().setLayout(null);
		
		JButton btnCreate = new JButton("Create");
		btnCreate.addActionListener(new ActionListener() 
		{
			public void actionPerformed(ActionEvent arg0) 
			{	
				recipeInput.setVisible(true);
			}
		});
		btnCreate.setToolTipText("Click to create a recipe");
		btnCreate.setBounds(58, 110, 117, 29);
		simpleMain.getContentPane().add(btnCreate);
		
		JButton btnOpen = new JButton("Open");
		btnOpen.setBounds(265, 110, 117, 29);
		simpleMain.getContentPane().add(btnOpen);
		simpleMain.getContentPane().setFocusTraversalPolicy(new FocusTraversalOnArray(new Component[]{btnCreate, btnOpen}));
	}
}
